#include <iostream>
using namespace std;
void Move(int n,char src,char dst){
	cout<<"move "<<n<<" from "<< src<<" to "<<dst<<endl;
}
void Hannoi(int n,char a,char b,char c){
	if(n==1){
		Move(1,a,c); 
	}
	else{
		Hannoi(n-1,a,c,b);
		Move(n,a,c);
		Hannoi(n-1,b,a,c);
	}
}
int main()
{
	int n;
	while(cin>>n){
		Hannoi(n,'a','b','c');
	}
	return 0;
} 
